#[derive(serde::Serialize, serde::Deserialize, sqlx::FromRow, Debug, Clone)]
pub struct DAppTransaction {
    pub id: Option<u64>,
    pub chain: String,
    pub contract: String,
    pub from_addr: String,
    pub recharge_addr: String,
    pub recharge_hash: String,
    pub collect_addr: Option<String>,
    pub collect_hash: Option<String>,
    pub time_stamp: String,
    pub block_number: String,
    pub num: String,
    pub decimals: u8,
    pub status: u8,
}

#[derive(sqlx::FromRow, Debug, Clone)]
pub struct DAppTransactionVO {
    pub id: Option<u64>,
    pub chain: String,
    pub contract: String,
    pub from_addr: String,
    pub recharge_addr: String,
    pub recharge_hash: String,
    pub collect_addr: Option<String>,
    pub collect_hash: Option<String>,
    pub time_stamp: String,
    pub block_number: String,
    pub num: String,
    pub decimals: u8,
    pub status: u8,

    pub from_key: String,
    pub contract_key: Option<String>,
}

#[repr(u8)]
pub enum TransactionStatus {
    Unprocessed = 0,
    RechargeProcessing = 1,
    RechargeSuccess = 2,
    CollectProcessing = 3,
    Success = 4,
}

impl From<TransactionStatus> for u8 {
    fn from(value: TransactionStatus) -> Self {
        value as u8
    }
}
